package com.tudouji.project.flow.service.impl;

import java.util.List;

import com.tudouji.common.utils.DateUtils;
import com.tudouji.common.utils.IdUtils;
import com.tudouji.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.flow.mapper.FlowtempMapper;
import com.tudouji.project.flow.domain.Flowtemp;
import com.tudouji.project.flow.service.IFlowtempService;

/**
 * 流程Service业务层处理
 * 
 * @author tudouji
 * @date 2021-05-20
 */
@Service
public class FlowtempServiceImpl implements IFlowtempService 
{
    @Autowired
    private FlowtempMapper flowtempMapper;

    /**
     * 查询流程
     * 
     * @param guid 流程ID
     * @return 流程
     */
    @Override
    public Flowtemp selectFlowtempById(String guid)
    {
        return flowtempMapper.selectFlowtempById(guid);
    }



    /**
     * 查询流程列表
     * 
     * @param flowtemp 流程
     * @return 流程
     */
    @Override
    public List<Flowtemp> selectFlowtempList(Flowtemp flowtemp)
    {
        return flowtempMapper.selectFlowtempList(flowtemp);
    }

    /**
     * 新增流程
     * 
     * @param flowtemp 流程
     * @return 结果
     */
    @Override
    public int insertFlowtemp(Flowtemp flowtemp)
    {
        flowtemp.setGuid(IdUtils.fastSimpleUUID());
        flowtemp.setCreatetime(DateUtils.getNowDate());
        flowtemp.setOperatorid(SecurityUtils.getLoginUser().getUser().getUserId().toString());
        return flowtempMapper.insertFlowtemp(flowtemp);
    }

    /**
     * 修改流程
     * 
     * @param flowtemp 流程
     * @return 结果
     */
    @Override
    public int updateFlowtemp(Flowtemp flowtemp)
    {
        return flowtempMapper.updateFlowtemp(flowtemp);
    }

    /**
     * 批量删除流程
     * 
     * @param guids 需要删除的流程ID
     * @return 结果
     */
    @Override
    public int deleteFlowtempByIds(String[] guids)
    {
        return flowtempMapper.deleteFlowtempByIds(guids);
    }

    /**
     * 删除流程信息
     * 
     * @param guid 流程ID
     * @return 结果
     */
    @Override
    public int deleteFlowtempById(String guid)
    {
        return flowtempMapper.deleteFlowtempById(guid);
    }
}
